package com.dcl.spride;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;

public class WhoseIp {
	IpInfo ipinfo = null;
	HashMap<String, String> map = new HashMap<String, String>();

	public IpInfo getIpinfo() {
		return ipinfo;
	}

	public void setIpinfo(IpInfo ipinfo) {
		this.ipinfo = ipinfo;
	}

	public HashMap<String, String> getMap() {
		return this.map;
	}

	public void setMap() {
		String getipinfo = ipinfo.getipinfo();
		if (getipinfo != null && !"".equals(getipinfo)) {
			String[] info = getipinfo.split(",");
			for (String str : info) {
				int middle = str.indexOf(';');
				String key = str.substring(middle + 1, middle + 14);
				String value = str.substring(1, middle);
				map.put(key, value);
			}
		}
	}

	// public static void main(String args[]){
	// Bean bean = new Bean();
	//
	// IpInfo ipinfo = new IpInfo();
	// ipinfo.setBean(bean);
	// WhoseIp whoseip = new WhoseIp();
	// whoseip.setIpinfo(ipinfo);
	// System.out.println("ding");
	// whoseip.setMap();
	// HashMap<String,String> map = whoseip.getMap();
	// Collection <String>c = map.keySet();
	// Iterator<String> iterator = c.iterator();
	// while(iterator.hasNext()){
	// String key =iterator.next();
	// System.out.print(key+"                 ");
	// System.out.println((map.get(key)));
	// }
	// }

}
